import React, { useEffect, useState } from 'react'
import MyNavbar from '../../../components/MyNavbar'
import request from '../../../api/request'
import { useParams, useSearchParams } from 'react-router-dom'
import styles from './css/index.module.css'
import { NoticeBar } from 'antd-mobile'
function Index() {
    const {id}=useParams()
    const [sp]=useSearchParams()
    const spObj=Object.fromEntries(sp)

    
    const [data,setData]=useState([])
    useEffect(()=>{
        request.get('/share/knowledgeBase/v1/findDiseaseKnowledge',{params:{id:id}}).then((res)=>{
            console.log(res);
            setData(res.data.result)
        })
    },[])

  return (
    <div className={styles.box}>
      <MyNavbar/>
      <NoticeBar icon={false} content={
        <div style={{color:'black',fontSize:'14px'}}><span>本模块知识仅供参考，如有需要，请在医生指导下使用</span></div>
      } color='error' />

        <h3 style={{margin:'10px 0'}}>{spObj.title}</h3>
        
      <div className={styles.content}>
        <span>
            <p><b>{'[病理]'}</b></p>
            <span>{data.pathology}</span>
        </span>
        <span>
            <p><b>{'[症状]'}</b></p>
            <span>{data.symptom}</span>
        </span>
        <span>
            <p>{'[宜与忌]'}</p>
            <span>{data.benefitTaboo}</span>
        </span>
        <span>
            <p><b>{'[西药治疗]'}</b></p>
            {
                data.westernMedicineTreatment&&data.westernMedicineTreatment.length>0?<span>{data.westernMedicineTreatment}</span>:<span>暂无</span>
            }
            
        </span>
        <span>
            <p><b>{'[中医治疗]'}</b></p>
            {data.chineseMedicineTreatment&&data.chineseMedicineTreatment.length>0? <span>{data.chineseMedicineTreatment}</span>:<span>暂无</span>}
           
        </span>
      </div>

      

    </div>
  )
}

export default Index
